package niuke;

import java.util.HashSet;
import java.util.Set;

public class Test5 {
	public static void main(String[] args) {
		String str = "qywyer23tdd";
		System.out.println(findFirstRepeat(str, str.length()));
	}

	public static char findFirstRepeat(String A, int n) {
		// write code here
		Set<Character> set = new HashSet<Character>();
		for (int i = 0; i < A.length(); i++) {
			char ch = A.charAt(i);
			set.add(ch);
			if (set.size() != i + 1) {
				return ch;
			}
		}
		return '0';
	}
}
